package com.bird.设计模式.结构型.外观模式;

/**
 * @data 2022/3/14 15:07
 * @author: bird
 * @description: 礼物兑换服务层 外观系统 用来统一提供或者管理子系统 提供统一的接口.
 */
public class GiftExchangeService {
    private QualityService qualityService=new QualityService();// 资格系统
    private PointsPaymentService pointsPaymentService=new PointsPaymentService();// 积分支付系统
    private ShippingService shippingService=new ShippingService();// 物流系统

    // 获取礼品兑换
    public void giftExchange(PointGift pointGift) {
        if (qualityService.isAvailable(pointGift)) {
            // 资格校验通过
            if (pointsPaymentService.pay(pointGift)) {
                //如果支付积分成功
                String shippingOrderNo = shippingService.shipGift(pointGift);
                System.out.println("物流下单成功,订单号是: " + shippingOrderNo);
            }
        }
    }
}
